add simplified chinese language option - #7
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Simplified Chinese (zh-Hans) as a selectable UI/editor language in RailBlocks, and refines some existing English/German UI strings/tooltips to improve translation clarity and consistency.
Changes:
- Introduces a new
zhlocale (custom RailBlocks tokens + Blocklyzh-hans) and registers it in the localization system. - Adds a Simplified Chinese option to the language picker and ensures the page uses UTF-8.
- Adjusts select English/German tooltips and UI labels for clearer phrasing.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/validate_translation_consistency.test.js | Includes zh_locale in translation consistency checks. |
| locales/zh/zh_tokens.js | Adds Simplified Chinese translations for block labels/tooltips/warnings. |
| locales/zh/zh_locale.js | Adds the Simplified Chinese locale configuration and UI/toolbox labels. |
| locales/en/en_tokens.js | Tweaks English tooltip/warning phrasing. |
| locales/en/en_locale.js | Simplifies English save/load UI labels. |
| locales/de/de_tokens.js | Tweaks German tooltip phrasing. |
| locales/de/de_locale.js | Simplifies German save/load UI labels. |
| frontend/localization.js | Registers zh in LANGUAGE_CONFIGS so it can be applied/stored. |
| frontend/index.html | Adds UTF-8 meta tag and a Simplified Chinese language menu entry. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Five unresolved Chinese localization issues remain in the final review comments.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (3)
locales/zh/zh_tokens.js:39
- The
%1value is到达or通过, but appending either after被produces malformed Chinese (被到达/被通过). This token is rendered byContactWaitStatement, so put the action before the track/contact phrase to form valid text for both options.
'等待直到 %3 的 %2 号触点被%1',
locales/zh/zh_tokens.js:64
- The literal
第is followed by dropdown values第一/第二, yielding第第一号/第第二号; it also uses被到达, which is not grammatical Chinese. Rewrite this sentence using the existing placeholder order so the static conditional block renders correctly.
'如果 %2 的第 %1 号触点最先被到达\n%3否则如果 %5 的第 %4 号触点最先被到达',
locales/zh/zh_tokens.js:72
- The dynamic branch block appends these fragments as start → contact ordinal → middle → track → end 1 → end 2. The current values therefore render text such as
如果第一号触点,属于轨道KH_ST_0被优先, which is ungrammatical and does not clearly state what happens first; adjust the fragments for this fixed order.
RAILBLOCKS_CONDITIONAL_TEXT_START: '如果',
RAILBLOCKS_CONDITIONAL_TEXT_MIDDLE: '号触点,属于轨道',
RAILBLOCKS_CONDITIONAL_TEXT_END_1: '被',
RAILBLOCKS_CONDITIONAL_TEXT_END_2: '优先',
- Files reviewed: 11/11 changed files
- Comments generated: 2
- Review effort level: Lite
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
some of the translations here are a little clunky due to the sentence structure. In particular the tokens with _TEXT_START and _TEXT_END make it awkward. It would be nice to have more flexibility here.
The strings regarding lights, tracks and points are currently difficult to translate
In Chinese something like "light number one" would translate to "number one light", which the current structure of the strings does not really seem to allow as far as I can tell